"""Base client abstract class for LLM backends."""

from abc import ABC, abstractmethod
from typing import Dict, Any
import aiohttp

from ..config import RequestResult


class BaseLLMClient(ABC):
    """Abstract base class for LLM clients."""
    
    def __init__(self, base_url: str, model: str, timeout: int = 120):
        """
        Initialize the client.
        
        Args:
            base_url: Base URL of the LLM service
            model: Model identifier
            timeout: Request timeout in seconds
        """
        self.base_url = base_url
        self.model = model
        self.timeout = timeout
    
    @abstractmethod
    async def generate(
        self,
        session: aiohttp.ClientSession,
        question: str,
        max_tokens: int = 512,
        temperature: float = 0.7
    ) -> RequestResult:
        """
        Generate a response for the given question.
        
        Args:
            session: aiohttp session for making requests
            question: Input question/prompt
            max_tokens: Maximum tokens to generate
            temperature: Sampling temperature
            
        Returns:
            RequestResult with response and metrics
        """
        pass
    
    def get_backend_name(self) -> str:
        """Get the backend name."""
        return self.__class__.__name__.replace("Client", "")

